<template>
    <LayMenu
        :tree="vertical"
        :selected-key="selected"
        @change-selected-Key="changeSelectedKey"
        @change-open-keys="changeOpenKeys"
        v-model:openKeys="opens"
        class="menu"
        >
        <slot></slot>
    </LayMenu>
</template>

<script setup lang="ts">
import { LayMenu } from '@layui/layui-vue';

defineProps<{
    vertical?: boolean;
}>();

const opens = defineModel<string[]>('opens');
const selected = defineModel<string>('selected');


const changeSelectedKey = (val: string) => {
    selected.value = val;
}

const changeOpenKeys = (val: string[]) => {
    opens.value = val;
}
</script>

<style scoped></style>
